package com.shop.cereshop.commons.enums.recommend;

import io.swagger.annotations.ApiModel;
import lombok.Getter;

@Getter
@ApiModel(value = "RecommendPublishEnum", description = "动态发布状态枚举")
public enum RecommendPublishEnum {

    UNAUDITED(0, "三方审核失败，待人工审核"),
    AUDIT_SUCCESS(1, "审核成功"),
    AUDIT_FAIL(2, "人工审核失败")
    ;

    private final Integer code;
    private final String msg;
    
    RecommendPublishEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    
    public static String getMsgByCode(Integer code) {
        for (RecommendPublishEnum item : RecommendPublishEnum.values()) {
            if (item.getCode().equals(code)) {
                return item.msg;
            }
        }
        return null;
    }

    public static Integer getCodeByMsg(String msg) {
        for (RecommendPublishEnum item : RecommendPublishEnum.values()) {
            if (item.getMsg().equals(msg)) {
                return item.code;
            }
        }
        return -1;
    }
}
